# 地图颜色展示
from pyecharts.charts import Map
from pyecharts.options import VisualMapOpts

if __name__ == '__main__':
    map=Map()

    data=[
        ("北京市",99),
        ("上海市",199),
        ("广东省",299),
        ("香港特别行政区",399),
        ("台湾省",499),
        ("青海省",599),
    ]

    map.add("全国销售图",data,"china")
    map.set_global_opts(
        visualmap_opts=VisualMapOpts(
            is_show=True,
            is_piecewise=True,
            pieces=[
                {"min":100,"max":200,"label":"100-200","color":"red"},
                {"min":200,"max":300,"label":"200-300","color":"yellow"},
                {"min":300,"max":400,"label":"300-400","color":"green"},
                {"min":400,"max":500,"label":"400-500","color":"blue"}
            ]
        )
    )
    map.render("map.html")